package com.sina.shop.dao.admin;

import com.sina.shop.dao.ShopDataSourceDao;
import com.sina.shop.domain.admin.Admin;
import org.springframework.stereotype.Repository;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * 段浩杰   2018-02-05-14:07
 */
@Repository("adminDao")
public class AdminDaoImpl extends ShopDataSourceDao implements AdminDao {

    @Override
    public Admin getAdminByAccount(String account) {
        String hql = "from Admin where account=:account";
        return unique(hql, new String[]{"account"}, new Object[]{account});
    }

    @Override
    public Admin getAdmin(String account) {
        String hql = "select new Admin(id,name,account) from Admin where account=:account";
        return unique(hql, new String[]{"account"}, new Object[]{account});
    }
}
